package easybooking.report;

import java.io.Serializable;
import java.util.Vector;

/**
 * A comppsite report. This report can consist of a quantity of sub reports.
 *
 *
 * @author Hakan Keles
 */
public abstract class CompositeReport
        extends Report
        implements Serializable {

    /**
     * The quantity of sub report.
     */
    private Vector<Report> subReports = new Vector<Report>();

    /**
     * Add a sub report.
     * @param r the added sub report.
     */
    public void addSubReport(Report r) {
        this.subReports.addElement(r);
    }

    /**
     * Remove a sub report.
     * @param r the removed sub report.
     */
    public void removeSubReport(Report r) {
        this.subReports.removeElement(r);
    }

    /**
     * Read-out the number of sub reports.
     * @return int Number of sub reports.
     */
    public int getNumSubReports() {
        return this.subReports.size();
    }

    /**
     * Read-out a single sub report.
     * @param i Index of the sub report.
     *
     * @return Index of the sub report.
     */
    public Report getSubReportAt(int i) {
        return this.subReports.elementAt(i);
    }
}
